SET.OPEN_SESSION Function

Syntax

<Set> as P = SET.Open_Session(C setname [,N file_open_mode|SQL::Arguments args [,C password]] )

Arguments

setname

The name of a set. The extension ".set" is assumed.

file_open_mode|SQL

Optional. Determines the access privileges that apply to the open set file. You can use one of the following system variables:

Variable
Function
FILE_RO_EXCLUSIVE

Read Only (Exclusive)

FILE_RW_EXCLUSIVE

Read or Write (Exclusive)

FILE_RO_SHARED

Read Only (Shared)

FILE_RW_SHARED

Read or Write (Shared)

password

Optional. Needed if the set has been encrypted, and the default encryption key has not been set (using the DEFAULT_ENCRYPTION_KEY_SET() function), of if the set was encrypted using a different encryption key than the default encryption key.

Description

Open an existing set in its own session - the session will be closed when the set is closed.

Discussion

SET.OPEN_SESSION() opens a set in a new session and returns a pointer to the set. Returns the <Set> pointer to the set.

Contrast this with the SET.OPEN() method which opens the set in the current session, making the primary table of the set into the primary table of the session.

See TABLE.OPEN() for a description of the Open_Mode and Password parameters.

Once the set has been opened, you can use the <Set> pointer variable to get pointers to the individual tables in the set. The syntax is:

<TBL> = <SET>.alias

where alias is the alias of the table in the set.

If you want to open a set from a button or event on a form, you must use SET.OPEN_SESSION(), and not SET.OPEN().

Example

Assume this script is attached to a button on a form.

dim s as P
dim t1 as P
dim t2 as P
s = set.open_session("invoice")
t1 = s.invoice_header
'get a pointer to the customer table
t2 = s.customer
'move to the last record in the invoice set
t1.fetch_last()
ui_msg_box("Note","Last order was placed by: " + t2.lastname
'close the set
s.close()

See Also